var form = layui.form;
layer = parent.layer === undefined ? layui.layer : top.layer,
    $ = layui.jquery;
function sub() {
    var checkBox = $("input[name='checkbox']:checked");
    // var checkBox=document.getElementsByName("checkbox");
    var permission = "";
    for(var i = 0; i< checkBox.length;i++){
        if(checkBox[i].checked===true) {
            permission += checkBox[i].value+",";
        }
    }
    $.ajax({
        type: "POST",
        data: {
            id:$("#beanId").val(),
            permission:permission
        },
        url: "/sysResource/savePermission",
        success: function (data) {
            layer.msg(data.msg, {time: 1000});
            var index=parent.layer.getFrameIndex(window.name); //获取当前窗口的name
            parent.layer.close(index);
        },
        error: function (data) {
            layer.alert(data.msg, {time: 1000});
        }
    });
}